﻿Imports System.Xml

Public Class InsetSpacing
	Public Sub New()
		ListItems = New List(Of ListItem)
	End Sub

	Public Property ListItems As List(Of ListItem)

	Public Shared Function ReadXml(reader As XmlReader) As InsetSpacing
		Dim result As New InsetSpacing

		While reader.Read()
			If reader.Name = "ListItem" Then
				Select Case reader.GetAttribute("type")
					Case "unit"
						result.ListItems.Add(New ListItemUnit(reader.ReadElementContentAsDouble()))
				End Select
			ElseIf reader.Name = "InsetSpacing" And reader.NodeType = XmlNodeType.EndElement Then
				Exit While
			End If
		End While

		Return result
	End Function
End Class
